/* Yet Another Experimental Software Renderer
 *
 * Copyright (c) 2010 Pawel "Hery" Dziepak
 */

#ifndef UTILS_H_
#define UTILS_H_

#include "vectors.h"

namespace yaesr {
	void swap(int &x, int &y);

	template<typename T>
	T lerp(T a, T b, double mix) {
		return a * (1.0 - mix) + b * mix;
	}

	template<typename T>
	T lerp3(T a, double alpha, T b, double beta, T c, double gamma) {
		return a * alpha + b * beta + c * gamma;
	}

	template<typename T>
	T max(T x, T y) {
		return x > y ? x : y;
	}

	template<typename T>
	T min(T x, T y) {
		return x < y ? x : y;
	}
}

#endif